<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人资料 - TechBlog</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            /* 亮色主题变量 */
            --bg-color: #ffffff;
            --text-color: #24292f;
            --border-color: #d0d7de;
            --card-bg: #f6f8fa;
            --header-bg: #f6f8fa;
            --accent-color: #0969da;
            --accent-hover: #0550ae;
            --code-bg: rgba(175, 184, 193, 0.2);
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
            --tag-bg: #ddf4ff;
            --tag-color: #0969da;
            --filter-bg: #f6f8fa;
            --input-bg: #ffffff;
            --success-color: #28a745;
            --warning-color: #ffc107;
            --error-color: #dc3545;
        }

        .dark-theme {
            /* 深色主题变量 */
            --bg-color: #0d1117;
            --text-color: #e6edf3;
            --border-color: #30363d;
            --card-bg: #161b22;
            --header-bg: #161b22;
            --accent-color: #2f81f7;
            --accent-hover: #1c6bdb;
            --code-bg: rgba(110, 118, 129, 0.4);
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7);
            --tag-bg: #388bfd26;
            --tag-color: #58a6ff;
            --filter-bg: #161b22;
            --input-bg: #0d1117;
            --success-color: #3fb950;
            --warning-color: #d29922;
            --error-color: #f85149;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            transition: background-color 0.3s, color 0.3s, border-color 0.3s;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.5;
        }

        .container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 头部导航 */
        header {
            background-color: var(--header-bg);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 0;
            position: relative;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 600;
            font-size: 20px;
            color: var(--text-color);
            text-decoration: none;
            z-index: 101;
        }

        .logo i {
            color: var(--accent-color);
        }

        .nav-links {
            display: flex;
            gap: 24px;
        }

        .nav-links a {
            color: var(--text-color);
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .nav-links a:hover {
            color: var(--accent-color);
        }

        .nav-links a.active {
            color: var(--accent-color);
            font-weight: 600;
        }

        .nav-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .theme-toggle {
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 8px 12px;
            color: var(--text-color);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            transition: all 0.2s ease;
        }

        .theme-toggle:hover {
            background-color: var(--code-bg);
        }

        .mobile-menu {
            display: none;
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-color);
            cursor: pointer;
            padding: 8px 12px;
            font-size: 16px;
            transition: all 0.2s ease;
        }

        .mobile-menu:hover {
            background-color: var(--code-bg);
        }

        /* 主要内容区域 */
        .main-content {
            padding: 32px 0;
        }

        /* 个人资料头部 */
        .profile-header {
            display: flex;
            gap: 24px;
            margin-bottom: 32px;
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 32px;
            position: relative;
        }

        .profile-avatar {
            flex-shrink: 0;
        }

        .avatar-image {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid var(--border-color);
        }

        .avatar-upload {
            position: relative;
            display: inline-block;
        }

        .avatar-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s ease;
            cursor: pointer;
        }

        .avatar-overlay i {
            color: white;
            font-size: 24px;
        }

        .avatar-upload:hover .avatar-overlay {
            opacity: 1;
        }

        .profile-info {
            flex: 1;
        }

        .profile-name {
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .profile-bio {
            font-size: 16px;
            opacity: 0.8;
            margin-bottom: 16px;
            line-height: 1.5;
        }

        .profile-stats {
            display: flex;
            gap: 24px;
            margin-bottom: 16px;
        }

        .stat-item {
            text-align: center;
        }

        .stat-number {
            font-size: 20px;
            font-weight: 600;
            color: var(--accent-color);
        }

        .stat-label {
            font-size: 14px;
            opacity: 0.8;
        }

        .profile-actions {
            display: flex;
            gap: 12px;
            margin-top: 16px;
        }

        .btn {
            padding: 8px 16px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            text-decoration: none;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1px solid var(--border-color);
        }

        .btn-primary {
            background-color: var(--accent-color);
            color: white;
            border-color: var(--accent-color);
        }

        .btn-primary:hover {
            background-color: var(--accent-hover);
            border-color: var(--accent-hover);
        }

        .btn-secondary {
            background-color: transparent;
            color: var(--text-color);
        }

        .btn-secondary:hover {
            background-color: var(--code-bg);
        }

        /* 内容区域 */
        .content-container {
            display: flex;
            gap: 32px;
            align-items: flex-start;
        }

        /* 侧边栏导航 */
        .sidebar {
            width: 250px;
            flex-shrink: 0;
        }

        .sidebar-nav {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            overflow: hidden;
        }

        .nav-item {
            display: block;
            padding: 12px 16px;
            color: var(--text-color);
            text-decoration: none;
            border-bottom: 1px solid var(--border-color);
            transition: all 0.2s ease;
        }

        .nav-item:last-child {
            border-bottom: none;
        }

        .nav-item:hover {
            background-color: var(--code-bg);
        }

        .nav-item.active {
            background-color: var(--accent-color);
            color: white;
        }

        .nav-item i {
            width: 20px;
            margin-right: 8px;
        }

        /* 主内容区域 */
        .profile-content {
            flex: 1;
            min-width: 0;
        }

        .content-section {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 24px;
            margin-bottom: 24px;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-color);
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
        }

        /* 文章网格 */
        .articles-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 16px;
        }

        .article-card {
            background-color: var(--bg-color);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 16px;
            transition: all 0.2s ease;
        }

        .article-card:hover {
            border-color: var(--accent-color);
            transform: translateY(-2px);
        }

        .article-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .article-title a {
            color: var(--accent-color);
            text-decoration: none;
        }

        .article-title a:hover {
            text-decoration: underline;
        }

        .article-meta {
            display: flex;
            gap: 12px;
            margin-bottom: 8px;
            font-size: 12px;
            opacity: 0.7;
        }

        .article-actions {
            display: flex;
            gap: 12px;
            margin-top: 12px;
        }

        .action-btn {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 4px 8px;
            background-color: var(--code-bg);
            color: var(--text-color);
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.2s ease;
        }

        .action-btn:hover {
            background-color: var(--accent-color);
            color: white;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 16px;
        }

        .form-label {
            display: block;
            margin-bottom: 6px;
            font-size: 14px;
            font-weight: 500;
        }

        .form-input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background-color: var(--input-bg);
            color: var(--text-color);
            font-size: 14px;
            transition: border-color 0.2s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
        }

        .dark-theme .form-input:focus {
            box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.2);
        }

        .form-textarea {
            min-height: 100px;
            resize: vertical;
        }

        .form-hint {
            font-size: 12px;
            opacity: 0.7;
            margin-top: 4px;
        }

        /* 标签样式 */
        .tags-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 8px;
        }

        .tag {
            background-color: var(--tag-bg);
            color: var(--tag-color);
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }

        /* 设置选项 */
        .settings-option {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .settings-option:last-child {
            border-bottom: none;
        }

        .option-info h4 {
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .option-info p {
            font-size: 12px;
            opacity: 0.7;
        }

        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 44px;
            height: 24px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--border-color);
            transition: .4s;
            border-radius: 24px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked+.toggle-slider {
            background-color: var(--accent-color);
        }

        input:checked+.toggle-slider:before {
            transform: translateX(20px);
        }

        /* 页脚 */
        footer {
            border-top: 1px solid var(--border-color);
            padding: 32px 0;
            text-align: center;
            font-size: 14px;
            color: var(--text-color);
            opacity: 0.8;
        }

        /* 响应式设计优化 */
        @media (max-width: 1024px) {
            .content-container {
                gap: 24px;
            }

            .sidebar {
                width: 220px;
            }
        }

        @media (max-width: 900px) {
            .content-container {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                order: -1;
                margin-bottom: 24px;
            }

            .sidebar-nav {
                display: flex;
                overflow-x: auto;
            }

            .nav-item {
                flex-shrink: 0;
                border-bottom: none;
                border-right: 1px solid var(--border-color);
            }

            .nav-item:last-child {
                border-right: none;
            }
        }

        @media (max-width: 768px) {
            .container {
                padding: 0 16px;
            }

            .navbar {
                padding: 12px 0;
            }

            .logo {
                font-size: 18px;
            }

            .nav-links {
                position: absolute;
                top: 100%;
                left: 0;
                width: 100%;
                background-color: var(--header-bg);
                border-top: 1px solid var(--border-color);
                flex-direction: column;
                padding: 16px 20px;
                display: none;
                box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            }

            .nav-links.active {
                display: flex;
            }

            .nav-links a {
                padding: 12px 0;
                border-bottom: 1px solid var(--border-color);
                font-size: 16px;
            }

            .nav-links a:last-child {
                border-bottom: none;
            }

            .mobile-menu {
                display: block;
                min-height: 44px;
                min-width: 44px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .theme-toggle,
            .mobile-menu {
                padding: 10px 14px;
            }

            .main-content {
                padding: 24px 0;
            }

            .profile-header {
                flex-direction: column;
                text-align: center;
                padding: 24px;
            }

            .profile-stats {
                justify-content: center;
            }

            .profile-actions {
                justify-content: center;
            }

            .articles-grid {
                grid-template-columns: 1fr;
            }

            /* 减少移动端的动画效果 */
            * {
                transition: none;
            }

            /* 保留必要的过渡 */
            .theme-toggle,
            .mobile-menu,
            .nav-links a,
            .btn,
            .nav-item,
            .article-card,
            .action-btn {
                transition: all 0.2s ease;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0 12px;
            }

            .profile-header {
                padding: 20px;
            }

            .avatar-image {
                width: 100px;
                height: 100px;
            }

            .profile-name {
                font-size: 24px;
            }

            .profile-stats {
                gap: 16px;
            }

            .profile-actions {
                flex-direction: column;
                align-items: center;
            }

            .content-section {
                padding: 16px;
            }

            .section-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }
        }
    </style>
</head>

<body class="light-theme">
    <header>
        <div class="container">
            <nav class="navbar">
                <a href="index.html" class="logo">
                    <i class="fas fa-code"></i>
                    TechBlog
                </a>

                <div class="nav-links">
                    <a href="index.html">首页</a>
                    <a href="article-list.html">文章</a>
                    <a href="tutorial-list.html">教程</a>
                    <a href="projects.html">项目</a>
                    <a href="about.html">关于</a>
                </div>

                <div class="nav-actions">
                    <button class="theme-toggle" id="themeToggle">
                        <i class="fas fa-moon"></i>
                        <span>深色模式</span>
                    </button>
                    <button class="mobile-menu" id="mobileMenu">
                        <i class="fas fa-bars"></i>
                    </button>
                </div>
            </nav>
        </div>
    </header>

    <div class="container">
        <div class="main-content">
            <!-- 个人资料头部 -->
            <div class="profile-header">
                <div class="profile-avatar">
                    <div class="avatar-upload">
                        <img src="https://avatars.githubusercontent.com/u/583231?v=4" alt="用户头像" class="avatar-image">
                        <div class="avatar-overlay">
                            <i class="fas fa-camera"></i>
                        </div>
                    </div>
                </div>
                <div class="profile-info">
                    <h1 class="profile-name">张开发者</h1>
                    <p class="profile-bio">全栈开发者，专注于React、Node.js和云计算。热爱开源，喜欢分享技术知识。</p>
                    <div class="profile-stats">
                        <div class="stat-item">
                            <div class="stat-number">42</div>
                            <div class="stat-label">文章</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-number">1.2k</div>
                            <div class="stat-label">粉丝</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-number">256</div>
                            <div class="stat-label">点赞</div>
                        </div>
                    </div>
                    <div class="profile-actions">
                        <button class="btn btn-primary">编辑资料</button>
                        <button class="btn btn-secondary">分享资料</button>
                    </div>
                </div>
            </div>

            <!-- 内容区域 -->
            <div class="content-container">
                <!-- 侧边栏导航 -->
                <aside class="sidebar">
                    <nav class="sidebar-nav">
                        <a href="#articles" class="nav-item active">
                            <i class="fas fa-file-alt"></i>我的文章
                        </a>
                        <a href="#drafts" class="nav-item">
                            <i class="fas fa-edit"></i>草稿箱
                        </a>
                        <a href="#bookmarks" class="nav-item">
                            <i class="fas fa-bookmark"></i>收藏文章
                        </a>
                        <a href="#settings" class="nav-item">
                            <i class="fas fa-cog"></i>账户设置
                        </a>
                        <a href="#notifications" class="nav-item">
                            <i class="fas fa-bell"></i>消息通知
                        </a>
                    </nav>
                </aside>

                <!-- 主内容区域 -->
                <main class="profile-content">
                    <!-- 我的文章部分 -->
                    <section id="articles" class="content-section">
                        <div class="section-header">
                            <h2 class="section-title">我的文章</h2>
                            <a href="editor.html" class="btn btn-primary">写新文章</a>
                        </div>
                        <div class="articles-grid">
                            <article class="article-card">
                                <h3 class="article-title">
                                    <a href="article-detail.html">深入理解React Hooks的工作原理</a>
                                </h3>
                                <div class="article-meta">
                                    <span><i class="far fa-calendar"></i> 2023-10-15</span>
                                    <span><i class="far fa-eye"></i> 1.2k</span>
                                </div>
                                <p>本文将深入探讨React Hooks的内部实现机制，包括useState、useEffect等常用Hook的工作原理...</p>
                                <div class="article-actions">
                                    <button class="action-btn">
                                        <i class="far fa-edit"></i> 编辑
                                    </button>
                                    <button class="action-btn">
                                        <i class="far fa-trash-alt"></i> 删除
                                    </button>
                                    <button class="action-btn">
                                        <i class="fas fa-chart-line"></i> 数据
                                    </button>
                                </div>
                            </article>

                            <article class="article-card">
                                <h3 class="article-title">
                                    <a href="#">Node.js性能优化完全指南</a>
                                </h3>
                                <div class="article-meta">
                                    <span><i class="far fa-calendar"></i> 2023-09-28</span>
                                    <span><i class="far fa-eye"></i> 890</span>
                                </div>
                                <p>在这篇文章中，我们将探讨Node.js应用程序的性能优化策略，包括内存管理、异步编程最佳实践...</p>
                                <div class="article-actions">
                                    <button class="action-btn">
                                        <i class="far fa-edit"></i> 编辑
                                    </button>
                                    <button class="action-btn">
                                        <i class="far fa-trash-alt"></i> 删除
                                    </button>
                                    <button class="action-btn">
                                        <i class="fas fa-chart-line"></i> 数据
                                    </button>
                                </div>
                            </article>

                            <article class="article-card">
                                <h3 class="article-title">
                                    <a href="#">TypeScript高级类型编程技巧</a>
                                </h3>
                                <div class="article-meta">
                                    <span><i class="far fa-calendar"></i> 2023-09-10</span>
                                    <span><i class="far fa-eye"></i> 650</span>
                                </div>
                                <p>从基础到高级，全面解析TypeScript的类型系统，掌握条件类型、映射类型等高级技巧...</p>
                                <div class="article-actions">
                                    <button class="action-btn">
                                        <i class="far fa-edit"></i> 编辑
                                    </button>
                                    <button class="action-btn">
                                        <i class="far fa-trash-alt"></i> 删除
                                    </button>
                                    <button class="action-btn">
                                        <i class="fas fa-chart-line"></i> 数据
                                    </button>
                                </div>
                            </article>
                        </div>
                    </section>

                    <!-- 账户设置部分 -->
                    <section id="settings" class="content-section" style="display: none;">
                        <div class="section-header">
                            <h2 class="section-title">账户设置</h2>
                        </div>
                        <form>
                            <div class="form-group">
                                <label for="username" class="form-label">用户名</label>
                                <input type="text" id="username" class="form-input" value="张开发者">
                                <div class="form-hint">用户名将显示在您的个人资料页和文章中</div>
                            </div>

                            <div class="form-group">
                                <label for="email" class="form-label">邮箱地址</label>
                                <input type="email" id="email" class="form-input" value="zhang@example.com">
                                <div class="form-hint">用于登录和接收重要通知</div>
                            </div>

                            <div class="form-group">
                                <label for="bio" class="form-label">个人简介</label>
                                <textarea id="bio"
                                    class="form-input form-textarea">全栈开发者，专注于React、Node.js和云计算。热爱开源，喜欢分享技术知识。</textarea>
                                <div class="form-hint">简短介绍自己，让其他用户了解您</div>
                            </div>

                            <div class="form-group">
                                <label class="form-label">技术标签</label>
                                <div class="tags-container">
                                    <span class="tag">React</span>
                                    <span class="tag">Node.js</span>
                                    <span class="tag">TypeScript</span>
                                    <span class="tag">MongoDB</span>
                                    <span class="tag">Docker</span>
                                </div>
                                <div class="form-hint">选择您擅长的技术领域</div>
                            </div>

                            <button type="submit" class="btn btn-primary">保存更改</button>
                        </form>
                    </section>

                    <!-- 通知设置部分 -->
                    <section id="notifications" class="content-section" style="display: none;">
                        <div class="section-header">
                            <h2 class="section-title">消息通知</h2>
                        </div>
                        <div class="settings-option">
                            <div class="option-info">
                                <h4>文章评论通知</h4>
                                <p>当有人评论您的文章时接收通知</p>
                            </div>
                            <label class="toggle-switch">
                                <input type="checkbox" checked>
                                <span class="toggle-slider"></span>
                            </label>
                        </div>

                        <div class="settings-option">
                            <div class="option-info">
                                <h4>新粉丝通知</h4>
                                <p>当有新用户关注您时接收通知</p>
                            </div>
                            <label class="toggle-switch">
                                <input type="checkbox" checked>
                                <span class="toggle-slider"></span>
                            </label>
                        </div>

                        <div class="settings-option">
                            <div class="option-info">
                                <h4>文章点赞通知</h4>
                                <p>当有人点赞您的文章时接收通知</p>
                            </div>
                            <label class="toggle-switch">
                                <input type="checkbox">
                                <span class="toggle-slider"></span>
                            </label>
                        </div>

                        <div class="settings-option">
                            <div class="option-info">
                                <h4>每周精选文章</h4>
                                <p>接收每周精选技术文章推荐</p>
                            </div>
                            <label class="toggle-switch">
                                <input type="checkbox" checked>
                                <span class="toggle-slider"></span>
                            </label>
                        </div>

                        <div class="settings-option">
                            <div class="option-info">
                                <h4>产品更新通知</h4>
                                <p>接收TechBlog平台的功能更新信息</p>
                            </div>
                            <label class="toggle-switch">
                                <input type="checkbox">
                                <span class="toggle-slider"></span>
                            </label>
                        </div>
                    </section>
                </main>
            </div>
        </div>
    </div>

    <footer>
        <div class="container">
            <p>© 2023 TechBlog. 保留所有权利。</p>
            <p>采用 Github 风格设计 | 由开发者为开发者打造</p>
        </div>
    </footer>

    <script>
        // 主题切换功能
        const themeToggle = document.getElementById('themeToggle');
        const themeIcon = themeToggle.querySelector('i');
        const themeText = themeToggle.querySelector('span');

        // 检查本地存储的主题偏好
        const currentTheme = localStorage.getItem('theme') || 'light';
        if (currentTheme === 'dark') {
            document.body.classList.add('dark-theme');
            themeIcon.classList.remove('fa-moon');
            themeIcon.classList.add('fa-sun');
            themeText.textContent = '浅色模式';
        }

        themeToggle.addEventListener('click', () => {
            document.body.classList.toggle('dark-theme');

            if (document.body.classList.contains('dark-theme')) {
                themeIcon.classList.remove('fa-moon');
                themeIcon.classList.add('fa-sun');
                themeText.textContent = '浅色模式';
                localStorage.setItem('theme', 'dark');
            } else {
                themeIcon.classList.remove('fa-sun');
                themeIcon.classList.add('fa-moon');
                themeText.textContent = '深色模式';
                localStorage.setItem('theme', 'light');
            }
        });

        // 移动端菜单切换
        const mobileMenu = document.getElementById('mobileMenu');
        const navLinks = document.querySelector('.nav-links');
        const menuIcon = mobileMenu.querySelector('i');

        mobileMenu.addEventListener('click', () => {
            navLinks.classList.toggle('active');

            if (navLinks.classList.contains('active')) {
                menuIcon.classList.remove('fa-bars');
                menuIcon.classList.add('fa-times');
            } else {
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // 点击菜单外区域关闭菜单
        document.addEventListener('click', (e) => {
            if (!e.target.closest('.navbar') && navLinks.classList.contains('active')) {
                navLinks.classList.remove('active');
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // 窗口大小变化时调整菜单状态
        window.addEventListener('resize', () => {
            if (window.innerWidth > 768) {
                navLinks.classList.remove('active');
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // 侧边栏导航切换
        document.querySelectorAll('.nav-item').forEach(item => {
            item.addEventListener('click', function (e) {
                e.preventDefault();

                // 移除所有active类
                document.querySelectorAll('.nav-item').forEach(nav => {
                    nav.classList.remove('active');
                });

                // 添加active类到当前项
                this.classList.add('active');

                // 隐藏所有内容区域
                document.querySelectorAll('.content-section').forEach(section => {
                    section.style.display = 'none';
                });

                // 显示对应的内容区域
                const targetId = this.getAttribute('href').substring(1);
                const targetSection = document.getElementById(targetId);
                if (targetSection) {
                    targetSection.style.display = 'block';
                }
            });
        });

        // 头像上传功能
        const avatarOverlay = document.querySelector('.avatar-overlay');
        avatarOverlay.addEventListener('click', function () {
            const fileInput = document.createElement('input');
            fileInput.type = 'file';
            fileInput.accept = 'image/*';

            fileInput.addEventListener('change', function (e) {
                if (this.files && this.files[0]) {
                    const reader = new FileReader();

                    reader.onload = function (e) {
                        document.querySelector('.avatar-image').src = e.target.result;
                    }

                    reader.readAsDataURL(this.files[0]);
                }
            });

            fileInput.click();
        });

        // 文章操作功能
        document.querySelectorAll('.action-btn').forEach(btn => {
            btn.addEventListener('click', function () {
                const action = this.querySelector('i').className;

                if (action.includes('fa-edit')) {
                    alert('跳转到文章编辑页面');
                } else if (action.includes('fa-trash-alt')) {
                    if (confirm('确定要删除这篇文章吗？此操作不可撤销。')) {
                        this.closest('.article-card').style.display = 'none';
                    }
                } else if (action.includes('fa-chart-line')) {
                    alert('显示文章数据分析');
                }
            });
        });
    </script>
</body>

</html>